package com.xdtech.forum.model;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import com.xdtech.core.model.BaseModel;

/**
 * 论坛文章模型
 * @author max.zheng
 * @create 2014-12-06 20:53:58
 * @since 1.0
 * @see 
 */
@Entity
@Table(name="FORUM_ARTICLE")
public class Article extends BaseModel implements Serializable{
	private static final long serialVersionUID = 1L;
	
	public Article(){
		super();
	}
	
	public Article(Long id) {
		super();
		this.id = id;
	}

	public Article(String title, String content, Category category)
	{
		super();
		this.title = title;
		this.content = content;
		this.category = category;
	}

	@Id
	@Column(name = "ID")
	@GeneratedValue(strategy = GenerationType.AUTO)
	private Long id;
	@Column(name="TITLE")
	private String title;
	@Column(name="CONTENT")
	private String content;
	@Column(name="IS_HOT")
	private String isHot;
	@Column(name="ICON")
	private String icon;
	@ManyToOne
	@JoinColumn(name = "MEMBER_ID")
	private Member member;
	@ManyToOne
	@JoinColumn(name = "CATEGORY_ID")
	private Category category = new Category();
	@OneToMany(mappedBy="article")
	private List<CommentInfo> commentInfos = new ArrayList<CommentInfo>();

	public void setId(Long id) {
		this.id = id;
	}
	public Long getId() {
		return id;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	public String getTitle() {
		return title;
	}
	public void setContent(String content) {
		this.content = content;
	}
	public String getContent() {
		return content;
	}
	public String getIsHot()
	{
		return isHot;
	}

	public void setIsHot(String isHot)
	{
		this.isHot = isHot;
	}

	public String getIcon() {
		return icon;
	}

	public void setIcon(String icon) {
		this.icon = icon;
	}

	public Member getMember() {
		return member;
	}
	public void setMember(Member member) {
		this.member = member;
	}
	public Category getCategory() {
		return category;
	}
	public void setCategory(Category category) {
		this.category = category;
	}

	public List<CommentInfo> getCommentInfos()
	{
		return commentInfos;
	}

	public void setCommentInfos(List<CommentInfo> commentInfos)
	{
		this.commentInfos = commentInfos;
	}
	
	
	
}
